<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="public::head('投票表决')">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8"></meta>

</head>
<body style="padding-top:50px;">
<input type="hidden" th:value="${session.Id}" id="id"/>
<input type="hidden" th:value="${session.Type}" id="Type"/>

<input type="hidden" th:value="${xiangmuId}" id="xiangmuId">
<input type="hidden" th:value="${xiangmuleixing}" id="xiangmuleixing">
<input type="hidden" th:value="${lunci}" id="lunci">

<div th:replace="public/top_vote::top"></div>

<div id="Votelist">

    <div class="primary-title" >
        <div style="padding-left: 65px;margin-top:5px;text-align: center;font-size:24px">
            <label  style="margin-left: 20px; ">{{xiangmu.xiangmuname}}</label>
            <span  class="btn btn-success" style="float:right;margin-right:15px;margin-top:5px;"
                   v-on:click="toRefresh()">刷新页面</span>
        </div>
        <div style="text-align: center;font-size:18px;margin-bottom: 20px;">
            <div>            
                <input v-if="!issubmited" type="button" class="btn btn-sm btn-primary" style="width: 60px" value="提交" @click="tosubmit()">
            <input v-if="issubmited" type="button" class="btn btn-sm btn-success" disabled style="width: 60px" value="已提交" @click="tosubmit()">
            <a v-if="isallsubmited"
               class='btn btn-info'
               style='width:120px;height:34px;color:#fff !important;'
               href="javaScript:void(0);"
               @click="HuizongbiaoView()">查看汇总表</a></div>

               <div v-if="xiangmuleixing=='219'||xiangmuleixing=='212'"><label  style="margin-top: 10px;margin-left: 20px;color: red ">{{keshi}}{{totalcount}}个品规<span v-if="needcount > 0">，保留不超过{{needcount}}个品规</span></label></div>

        </div>
        
        <div  v-if="isVoteAll(xiangmuleixing)&&!issubmited" style="text-align: center;font-size:18px;padding-top: 10px;">
            <button v-if="isVoteAll(xiangmuleixing)&&!issubmited" class="btn btn-default" @click="voteAll(1)" style="margin-left:15px;">一键勾选</button>
            <button v-if="isVoteAll(xiangmuleixing)&&!issubmited"  class="btn btn-default" @click="voteAll(0)" style="margin-left:15px;">一键取消</button>
        </div>
    </div>

    <div v-if="isVoteAll(xiangmuleixing)&&!issubmited" style="height: 50px"></div>

    <div class="primary-content" style="margin-top: 50px;">

        <div id="List" >
        </div>

        <div v-if="!show" style="text-align:center;width:100%;">正在加载中......</div>

        <div v-if="xiangmuleixing=='217'||xiangmuleixing=='218'" class="my-page-navigation">
            <button class="btn btn-default" v-on:click="SetPageIndex">首页</button>
            <button class="btn btn-default" v-on:click="SetPageIndexPrePage">上一页</button>
            <span v-text="pageIndex + '  /  ' + pageCount"></span>
            <span v-text="'共' + recordCount + '条' + '品种'"></span>
            <button class="btn btn-default" v-on:click="SetPageIndexNextPage">下一页</button>
            <button class="btn btn-default" v-on:click="SetPageEnd">尾页</button>
            <span>跳到第</span>
            <input type="text" class="form-control" style="width: 80px;display:inline-block;"  v-model="inputPageIndexValue" v-on:keyup.enter="JumpPage">
            <span>页</span>
            <button class="btn btn-default" v-on:click="JumpPage">跳</button>
        </div>

    </div>

</div>

</body>
<script th:src="@{/js/TyConfig.js?v=1.05}"></script>
<script th:src="@{/js/vote/list_ty_vote.js?v=1.05}"></script>

<script type="text/javascript">

    var ID = $("#id").val();
    $(function() {
        if(ID==""){
            alert("请先登录！");
            location.href='../main/login';
        }
    });
    function colorizeTableWithRowspans(tbody) {
        const rows = tbody.querySelectorAll('tr');
        let colorToggle = false; // 初始颜色状态
        let skipRows = 0; // 需要跳过的行数

        rows.forEach((row, index) => {
            if (skipRows > 0) {
                skipRows--;
                return;
            }

            // 检查是否有rowspan
            const rowspanCell = row.querySelector('[rowspan]');
            if (rowspanCell) {
                const span = parseInt(rowspanCell.getAttribute('rowspan')) || 1;
                skipRows = span - 1;

                // 为合并行及其后续行设置相同颜色
                for (let i = 0; i < span; i++) {
                    if (rows[index + i]) {
                        rows[index + i].style.backgroundColor = colorToggle ? '#ffffff' : '#a0d4e4';
                    }
                }
            } else {
                row.style.backgroundColor = colorToggle ? '#ffffff' : '#a0d4e4';
            }

            // 切换颜色状态
            colorToggle = !colorToggle;
        });
    }

</script>

<style>
    /*.table-body table tr:nth-child(2n+1){background-color:lightblue}*/

    .hovermain{
        position: relative;
    }
    .hovertip{
        position: absolute;
        top: 50%;
        left: 50%;
        font-size: 16px;
        color: #333;
        background-color: #fff;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        width: 400px;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        padding: 10px;
        z-index: 1000;
        font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
        text-indent: 2em;
        text-align: left;
    }
    .hovermain:hover .hovertip{
        opacity: 1;
        visibility: visible;
        transform: translateX(5px);
    }
    .hovermain .text-content {
        word-wrap: break-word;
        word-break: break-all;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 5;
        -webkit-box-orient: vertical;
    }
    table{
        border:1px solid #e6e6e6;
        /*line-height: 5vh;*/
        color:#666666;
        font-size: 16px;
    }
    table {
        border-collapse: collapse;
        width: 100%;
    }
    td {
        padding:5px;
        border:1px solid #e6e6e6;
        font-size: 14px;
    }

    .table-head{padding-right:17px;background-color: #CDCDCD;color:#000;}
    .table-body{width:100%; height:750px;overflow-y:scroll;overflow-x:hidden;}
    .table-head table,.table-body table{width:100%;}
    /*.table-body table tr:nth-child(2n+1){background-color:lightblue}*/

    .table-body table tr:hover {
        background-color:#F0F9E4;
        transition: .2s;
    }
    .table-body table tr:hover td{background-color:#dff0d8;}

    a {
        text-decoration: none;
        color:#333;
    }
    /*正常的未被访问过的链接*/
    a:link {
        text-decoration: none;
    }
    /*已经访问过的链接*/
    a:visited {
        text-decoration: none;
    }
    /*鼠标划过(停留)的链接*/
    a:hover {
        text-decoration: none;
    }
    /* 正在点击的链接*/
    a:active {
        text-decoration: none;
    }

    .tt {
        width: 100%;
        position: fixed;
    }

    .select-form-control {
        height: 34px;
        padding: 6px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        background-color: #fff;
        background-image: none;
        border: 1px solid #ccc;
        border-radius: 4px;
        -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
        box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
        -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
        -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
        transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    }
    .huanghang {
        word-wrap: break-word;
    }
</style>

</html>
